package com.example.thridhero.broadcastbestpractice;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.Button;

/**
 * Created by thridHero on 2017/3/29.
 */

public class IndexActivity extends BaseActivity {

    private Button logoutBtn;

    public static void onActionStart(Context context){
        Intent intent = new Intent(context,IndexActivity.class);
        context.startActivity(intent);
    }
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        logoutBtn = (Button) findViewById(R.id.login_out);

        logoutBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Log.d("IndexActivity", "onClick: #######################");
                Intent intent = new Intent("com.example.thridhero.broadcastbestpractice.LOGOUT");
                sendBroadcast(intent);
            }
        });
    }
}
